package com.xms.sdk.service;

import com.xms.core.data.Entity;
import com.xms.core.exception.XmsException;
import com.xms.core.model.PagedList;
import com.xms.sdk.core.query.OrderExpression;
import com.xms.sdk.core.query.QueryBase;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;

/**
 * <p>
 * IDataFinder
 * </p>
 *
 * @author migo
 * @since 2021/9/6
 */
public interface IDataFinder {
    Entity retrieve(QueryBase request, boolean ignorePermissions) throws Exception;
    Entity retrieveById(String entityName, UUID id, String primarykey, boolean ignorePermissions) throws Exception;
    Entity retrieveById(String entityName, UUID id, String primarykey) throws Exception;
    Entity retrieveById(String entityName, UUID id, boolean ignorePermissions) throws Exception;
    Entity retrieveById(String entityName, UUID id) throws Exception;
    Entity retrieveByAttribute(String entityName, HashMap<String, Object> key_value, List<String> columns, boolean ignorePermissions) throws Exception;
    Entity retrieveByAttribute(String entityName, HashMap<String, Object> key_value, List<String> columns) throws Exception;
    Entity retrieveByAttribute(String entityName, HashMap<String, Object> key_value) throws Exception;
    List<Entity> retrieveMultipleByAttribute(String entityName, HashMap<String, Object> key_value) throws Exception;

    List<Entity> retrieveAll(QueryBase request, boolean ignorePermissions) throws XmsException, SQLException;
    List<Entity> retrieveAll(String entityName, List<String> columns, OrderExpression order, boolean ignorePermissions) throws XmsException, SQLException;
    List<Entity> retrieveAll(String entityName, List<String> columns, OrderExpression order) throws XmsException, SQLException;
    List<Entity> retrieveAll(String entityName, List<String> columns) throws XmsException, SQLException;
    List<Entity> retrieveAll(String entityName) throws XmsException, SQLException;

    PagedList<Entity> retrieveMultiple(QueryBase request, boolean ignorePermissions) throws Exception;

    Entity retrieve(QueryBase request) throws Exception;

    List<Entity> retrieveAll(QueryBase request) throws XmsException, SQLException;

    PagedList<Entity> retrieveMultiple(QueryBase request) throws Exception;
}
